{template 'common/header'}
{if !$_GPC['operation']}
<div class="main">
    <form action="" method="post" class="form-horizontal form">
        <a class="btn btn-primary" href="{php echo $this->createWebUrl('activity', array('operation' => 'add'))}"><i class="icon-plus"></i> 添加活动</a>
        <div style="padding-top: 15px;"></div>
        <div class="panel panel-default">
            <div class="table-responsive panel-body">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                    <tr>
                        <th style="width:22%;">活动名称</th>
                        <th style="width:10%;">连续签到多少天获得积分</th>
                        <th style="width:10%;">可获得积分</th>
                        <th style="width:10%;">操作</th>
                    </tr>
                    </thead>
                    <tbody id="level-list">
					{loop $activitylist $item}
                    <tr>
                        <td>{$item['name']}</td>
                        <td>{$item['daytime']}</td>
                        <td>{$item['point']}</td>
                        <td><a href="{php echo $_W['siteroot'].substr($this->createWebUrl('activity',array('operation'=>'update','id'=>$item['id'])),2)}" class="btn btn-primary">编辑</a>
                        	<a href="{php echo $_W['siteroot'].substr($this->createWebUrl('activity',array('operation'=>'delete','id'=>$item['id'])),2)}" class="btn btn-primary">删除</a>
                        </td>
                    </tr>
                    {/loop}
                    </tbody>
                    
                    <tfoot>
                    <tr>
                        <td colspan="7">
                            <input type="hidden" name="token" value="{$_W['token']}" />
                        </td>
                    </tr>
                    </tfoot>
                </table>
            </div>
        </div>
    </form>
</div>
{/if}
{if $_GPC['operation']=='add'||$_GPC['operation']=='update'}
<form action="{if $_GPC['operation']=='add'}{php echo $this->createWebUrl('activity',array('operation'=>'add','op'=>'additem'))}{/if}{if $_GPC['operation']=='update'}{php echo $this->createWebUrl('activity',array('operation'=>'update','op'=>'updateitem','id'=>$_GPC['id']))}{/if}" method="post" class="form-horizontal form" id="setting-form">
    <div class="panel panel-default">
			<div class="panel-heading">{if $_GPC['operation']=='add'}添加活动{/if}{if $_GPC['operation']=='update'}修改活动{/if}</div>
			<div class="panel-body">
				<div class="tab-content">
					<div class="tab-pane active" style="padding:20px;">

                          <div class="form-group">
                                <div class="input-group">
                                    <span class="input-group-addon">活动名称:</span>
                             
                                    <input type="text" name="name" value="{$activityitem['name']}" class="form-control">
                                </div>
                                
                           </div>
                          <div class="form-group">
                                <div class="input-group">
                                    <span class="input-group-addon">连续签到多少天获得积分:</span>
                                    <input type="text" name="daytime" value="{$activityitem['daytime']}" class="form-control">
                                </div>
                                
                           </div>                           
                          <div class="form-group">
                                <div class="input-group">
                                    <span class="input-group-addon">可获得积分:</span>
                                    <input type="text" name="point" value="{$activityitem['point']}" class="form-control">
                                </div>
                                
                           </div>
					</div>
					<input type="submit" class="btn btn-primary" value="保存"/>
				</div>
			</div>
		</div>
</form>
{/if}